<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet">


    <title>商城主页</title>
    <style>
        /* 样式可以根据需要自行定义 */
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            background-color: #f0f0f0;
            margin: 0;
            padding: 20px;
        }

        .coupon-list {
            margin-top: 20px;
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        table, th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
        }

        tr:nth-child(even) {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>

<h2>商城主页</h2>

<div class="coupon-list">
    <h3>优惠券列表</h3>
    <table>
        <thead>
        <tr>
            <th>Coupon ID</th>
            <th>Coupon Number</th>
            <th>Customer ID</th>
            <th>Customer Name</th>
            <th>Coupon Name</th>
            <th>Coupon Price</th>
            <th>Status</th>
            <th>Actions</th>
        </tr>
        </thead>
        <tbody>
        <!-- 使用Thymeleaf迭代显示优惠券信息 -->
        <tr th:each="coupon : ${coupons}">
            <td th:text="${coupon.mycouponId}"></td>
            <td th:text="${coupon.mycouponNumber}"></td>
            <td th:text="${coupon.customerId}"></td>
            <td th:text="${coupon.customerName}"></td>
            <td th:text="${coupon.mycouponName}"></td>
            <td th:text="${coupon.mycouponPrice}"></td>
            <td th:text="${coupon.mycouponStatus}"></td>
            <td>
                <!-- 编辑按钮 -->
                <a th:href="@{/editCoupon/{id}(id=${coupon.mycouponId})}" class="btn btn-primary">编辑</a>
                <!-- 删除按钮 -->
                <a th:href="@{/deleteCoupon/{id}(id=${coupon.mycouponId})}" class="btn btn-danger">删除</a>
            </td>
        </tr>
        </tbody>
    </table>
</div>

</body>
</html>
